
Page({

  /**
   * 页面的初始数据
   */
  data: {
    msg:"这是小程序"
  },

  fn(){
    console.log(this.data.msg);
    wx.getLocation({
      altitude: 'altitude',
      success: res => {
        console.log(res);
      }
    })
  },
  onLoad(options) {
    console.log('onLoad');
    console.log(getCurrentPages(), 222);
  },

  onReady() {
    console.log('onReady');
  },

  onShow() {
    console.log('onShow');
  },

  onHide() {
    console.log('onHide');
  },

  onUnload() {
    console.log('onUnload');
  },


  onPullDownRefresh() {
    console.log('数据开始请求了');
   setTimeout(() => {
      console.log('数据过来了，此时');
      // 调用api 手动结束下拉动作
      wx.stopPullDownRefresh()
    }, 2000) 
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
    console.log('上拉触底了');
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {
    return {
      title: '小哥哥小姐姐过来玩啊?',
      imageUrl: 'https://img0.baidu.com/it/u=121553601,3528777743&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=313'
    }
  },
  onShareTimeline(){
    return {
      title: '小哥哥小姐姐过来玩啊?',
      imageUrl: 'https://img0.baidu.com/it/u=121553601,3528777743&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=313'
    }
  },
  onPageScroll({scrollTop}){
    console.log(scrollTop);
  }
})